﻿using System;
using BITS.PreCompiler.CSharp.Syntax;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BITS.PreCompiler.CSharp.Tests.Syntax
{
    [TestClass]
    public class TestModule : TestBase
    {
        [TestMethod]
        public void Create_Module()
        {
            var module = new Module();

            var expectet = Comparer.Create_Module();
            var actual   = module.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }

        [TestMethod]
        public void Create_Module_With_Namespace()
        {
            var @namespace = new Namespace("MyNamespace");

            var module = new Module(@namespace);

            var expectet = Comparer.Create_Module_With_Namespace();
            var actual   = module.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }

        [TestMethod]
        public void Create_Module_With_Using_And_Namespace()
        {
            var module = new Module("MyNamespace")
            {
                new Using("System"),
            };

            var expectet = Comparer.Create_Module_With_Using_And_Namespace();
            var actual   = module.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }


        public static class Comparer
        {
            public static String Create_Module()
            {
                return
@"";
            }

            public static String Create_Module_With_Namespace()
            {
                return
@"namespace MyNamespace
{
}
";
            }

            public static String Create_Module_With_Using_And_Namespace()
            {
                return
@"using System;
namespace MyNamespace
{
}
";
            }
        }
    }
}
